package cn.smbms.service.provider;

import java.sql.Connection;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;


import cn.smbms.dao.provider.ProviderMapper;
import cn.smbms.pojo.Provider;
import cn.smbms.pojo.User;
@Service
public class ProviderServiceImpl implements ProviderService{
	
	@Resource
	private ProviderMapper providerMapper;
	
	/**
	 * 增加供应商信息
	 * @return
	 * @throws Exception
	 */
	public int add(Provider provider)throws Exception{
		return providerMapper.add(provider);
	}

	
	/**
	 * 通过条件分页查询
	 * @return
	 * @throws Exception
	 */
	public List<Provider> getProviderListByPages(Map<String,Object> map)throws Exception{
		return providerMapper.getProviderListByPages(map);
	}
	
	/**
	 * 通过条件查询-供应商表记录数
	 * @return
	 * @throws Exception
	 */
	public int getProviderCount(@Param("proCode")String proCode,
							@Param("proName")String proName)throws Exception{
		return providerMapper.getProviderCount(proCode, proName);
	}
	
	/**
	 * 通过Id删除供应商
	 * @param delId
	 * @return
	 * @throws Exception
	 */
	public int deleteProviderById(@Param("id")Integer id)throws Exception{
		return providerMapper.deleteProviderById(id);
	}
	
	
	/**
	 * 通过Id获取供应商
	 * @param connection
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public Provider getProviderById(@Param("id")Integer id)throws Exception{
		return providerMapper.getProviderById(id);
	}
	
	/**
	 * 修改供应商信息
	 * @param connection
	 * @return
	 * @throws Exception
	 */
	public int modify(Provider provider)throws Exception{
		return providerMapper.modify(provider);
	}
}
